home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PROGEDIT
/
3458B.ZIP
/
AMAC44B.ZIP
/
RFR004.QM
< prev
next >
Wrap
Text File
|
1992-06-22
|
52KB
|
980 lines
* rfr004.qm
* Macros to Right/Left Justify and Align
* Written By Tom Hogshead
* [ See RFRMxx.QM For Use ]
* 6/13/92
* Key Subfile Description
* ===== =============== ====================================================
*-- Justify and Align Macros . .
* @0 Left Justify Text in Line or Block ( ) |new
* to Designated Column
* @1 Right Justify Column Block
* @2 Left Justify Column Block
* @3 Align Column Block by Decimal Point
* @4 Align Column Block by Decimal Point, Fill Zeros
* @5 Comma Delineate and Align Column Block
* by Decimal Point, Fill with Zeros
* @6 Comma Delineate and Align Column Block
* by Decimal Point, Fill with Zeros, Add $'s
* @9 Right Justify Paragraph |chg
* @f7 Left Justify Any Type Block
* @f8 Left Justify File
*
*-- Right Justify Using RJ.COM . .
* @f1 Right Justify Block Using RJ.COM
* @f2 Removes Right Justification from Block
* @f3 Right Justify File Using RJ.COM
* @f4 Removes Right Justification from File
* @f5 Right Justify File Using RJ.COM, Screen Preview
*-- Other Column Block Macros . .
* @7 {e:\up\mis003} Make Column Block Longest Line in Block
* @2 {e:\up\mis003} Make Column Block Longest Line in Paragraph
* @6 {e:\up\mis003} Make Column Block Longest Line in File
* @1 {e:\up\mis003} Make Column Block Longest Line
* @3 {e:\up\mis003} Make Column Block Longest Line, Exclude Leading Spcs
* @4 {e:\up\mis003} Convert Any Block to Column Block 73 Column Wide
*
* {e:\up\RFRM*} Return To RFRMxx.QM
*
* Documentation for RJ.COM
*
*-- eoi
*
* ┌─────────────────┐
* │123456789 │
* │ 123456789.1 │
* │123456789.12 │
* ┌──┤ 123456789.123│ <── Numbers marked as a column block
* │ │123456789 │
* │ │ 123456789.1 │
* │ │123456789.12 │
* │ │ 123456789.123│
* │ └─────────────────┘ Become this
* │
* │ @1 Right Justify @2 Left Justify @3 Align
* │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
* │ │ 123456789│ │123456789 │ │ 123456789 │
* │ │ 123456789.1│ │123456789.1 │ │ 123456789.1 │
* │ │ 123456789.12│ │123456789.12 │ │ 123456789.12 │
* │ │ 123456789.123│ │123456789.123 │ │ 123456789.123│
* ├──┤ 123456789│ │123456789 │ │ 123456789 │
* │ │ 123456789.1│ │123456789.1 │ │ 123456789.1 │
* │ │ 123456789.12│ │123456789.12 │ │ 123456789.12 │
* │ │ 123456789.123│ │123456789.123 │ │ 123456789.123│
* │ └─────────────────┘ └─────────────────┘ └─────────────────┘
* │
* │ @4 Align/Fill Zeros @5 Align/Fill Zeros, @6 Align/Fill Zeros,
* │ Add Commas Add Commas and $'s
* │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
* │ │ 123456789.000│ │ 123,456,789.000│ │ $123,456,789.000│
* │ │ 123456789.100│ │ 123,456,789.100│ │ $123,456,789.100│
* │ │ 123456789.120│ │ 123,456,789.120│ │ $123,456,789.120│
* │ │ 123456789.123│ │ 123,456,789.123│ │ $123,456,789.123│
* └──┤ 123456789.000│ │ 123,456,789.000│ │ $123,456,789.000│
* │ 123456789.100│ │ 123,456,789.100│ │ $123,456,789.100│
* │ 123456789.120│ │ 123,456,789.120│ │ $123,456,789.120│
* │ 123456789.123│ │ 123,456,789.123│ │ $123,456,789.123│
* └─────────────────┘ └─────────────────┘ └─────────────────┘
* M A C R O S
* --------------------------------------------------------------------
* @(1) Right Justify Column Block, Ver. 2
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 123456789.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3│ │ 123456789│
* │ 1234.56│ │ 123456789.1│
* │ │ │ 123456789.12│
* │ .02│ │ 123456789.123│
* │ 213.679│ │ 123456789│
* │ 432.0│ │ 123456789.1│
* └──────────────┘ │ 123456789.12│
* │ 123456789.123│
* └─────────────────┘
@1 macrobegin
setscreenoff
editfile "nul" return quit gotoblockbeg jfalse END editfile return
copyblock gotoblockend cursorleft addline #173 cursorup
LOOP:
unmarkblock markcolumn endline *|
cut begline paste endline jtrue EMPTY gotoblockend
EMPTY:
cursorleft cursorup jtrue LOOP begfile cursorright
markcolumn endfile cursorup *|
copy quit pasteover
END: unmarkblock
*
* 50 bytes Mon 03-18-1991 21:52:05 (RB #f8, #24/317)
* 54 bytes Mon 01-13-1992 08:38:54 (TH @1, changed loop algorithm)
* 54 bytes Mon 03-30-1992 17:40:55 (TH @1, to GG #20/487)
* 52 bytes Tue 03-31-1992 09:47:19 (TH @1, v2, removed extra markcolumn's)
* 52 bytes Tue 03-31-1992 09:47:19 (TH @1, to All #3/827-828)
* 52 bytes Tue 03-31-1992 09:47:19 (TH @1, to All #3/829-830)
*
* --------------------------------------------------------------------
* @(2) Left Justify Column Block, Ver. 3, (Mod to R. Blackburn Macro)
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 123456789.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │3 │ │123456789 │
* │1234.56 │ │123456789.1 │
* │ │ │123456789.12 │
* │.02 │ │123456789.123 │
* │213.679 │ │123456789 │
* │432.0 │ │123456789.1 │
* └──────────────┘ │123456789.12 │
* │123456789.123 │
* └─────────────────┘
@2 MacroBegin
setscreenoff *|
EditFile "nul" Return Quit * Quit nul file if loaded
GotoBlockBeg JFalse END * Position cursor for paste back *|
EditFile Return * Load empty nul file
"a" Return * Insert "a" in column to align
* text below left justified
CopyBlock * Copy block to justify to nul
Label0:
Align * Justify line left
JTrue Label0 * and do until no more to do
Cut * Then cut block to scrap
Quit * Quit nul file
PasteOver * And paste it where we were
UnmarkBlock * Unmark left justified block
END: *|
*
* 28 bytes Mon 03-18-1991 21:51:51 (RB #f7, #24/317)
* 29 bytes Mon 01-13-1992 08:59:29 (TH @2, v2.15 reqd.)
* 29 bytes Mon 03-30-1992 15:43:35 (TH @2, to GG #20/487)
* 32 bytes Thu 04-02-1992 07:23:55 (TH @2, end macro if no block, Ver. 3)
* 32 bytes Thu 04-02-1992 07:23:55 (TH @2, to All #3/827-828)
* 32 bytes Thu 04-02-1992 07:23:55 (TH @2, to All #3/829-830)
*
* --------------------------------------------------------------------
* @(3) Align Column Block By Decimal Point, Ver. 3
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 123456789.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │ 123456789 │
* │ 1234.56 │ │ 123456789.1 │
* │ │ │ 123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │ 123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │ 123456789.12 │
* │ 123456789.123│
* └─────────────────┘
@3 macrobegin
setscreenoff
savesettings setsoundoff setwordwrapmode togglewordwrap
editfile "nul" return quit gotoblockbeg jfalse END
editfile return copyblock markline
* *── Add This Line to Have Dollar Signs ───────────────────────────────┐
* findreplace "$" return " " return "gn" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* -------------------- Find Decimal Point Line 1 -------------------*
find "." return "L" return jtrue DOT1 endline
* *── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
* jfalse DOT1 "." cursorleft * │
* *-─────────────────────────────────────────────────────────────────────┘
DOT1: unmarkblock markcolumn endline storescrbuff "x" return cut
LINE: cursordown jfalse FIN
begline unmarkblock markline
* -------------------- Find Decimal Point Line 2+ ------------------*
find return "L" return jtrue DOT2 endline
* *── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
* jfalse DOT2 "." cursorleft * │
* *-─────────────────────────────────────────────────────────────────────┘
* ---------- Append Decimal Point + Fraction to Buffer "x" ---------*
DOT2: unmarkblock markcolumn endline appendscrbuff "x" return cut
jump LINE
* ------------ Make Numbers w/o Fractions a Column Block -----------*
FIN: begfile markcolumn
1A: endline 2A: cursorleft markcolumn cursordown jfalse 4A
3A: jump 1A 4A: gotoblockend cursorleft addline #173 cursorup
* *─- Add This Line to Comma Delineate Columns ─────────────────────────┐
* findreplace "," return delline return "gn" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* --------------- Right Justify Numbers w/o Fractions --------------*
LOOP: unmarkblock markcolumn endline
cut begline paste endline jtrue EMPTY gotoblockend
EMPTY: cursorleft cursorup jtrue LOOP
begfile cursorright unmarkblock markcolumn endfile cursorup
* *─- Add These Lines to Comma Delineate Columns ────────────────────────┐
* markcolumn cursorright * │
* COMMA_SPACE: * │
* cursorleft cursorleft cursorleft * │
* cursorleft jfalse ADD_COMMA * │
* isbegline jtrue ADD_COMMA * │
* gotoblockbeg markcolumn prevposition shiftleft * │
* jump COMMA_SPACE * │
* ADD_COMMA: * │
* endfile cursorup markcolumn begfile * │
* findreplace " " return "," return "n" return * │
* findreplace ",," return " " return "n" return * │
* findreplace " ," return " " return "n" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* *── Add These 2 Lines to Have Dollar Signs ───────────────────────────┐
* setinsmode toggleinsert * │
* DOLLAR: firstnonwhite cursorleft "$" cursordown jtrue DOLLAR * │
* *-─────────────────────────────────────────────────────────────────────┘
* ------------- Paste Right Justified Whole Numbers Back -----------*
copy quit pasteover
* --------- Make Column Block of Decimal Points + Fractions --------*
gotoblockend markline gotoblockbeg
editfile return getscrbuff "x" return unmarkblock markcolumn
1B: endline 2B: cursorleft markcolumn cursordown jfalse 4B
3B: jump 1B 4B:
* *── To Fill With Trailing Zeros, Uncomment These 2 Lines ─────────────┐
* gotoblockbeg copy paste * │
* findreplace " " return "0" return "ln" return * │
* *-─────────────────────────────────────────────────────────────────────┘
copy quit pasteover * Paste decimal points + fractions back
* *── To Add Leading Zero, Uncomment These 2 Lines ──────────────────────┐
* cursorleft cursorleft markcolumn * │
* findreplace " ." return "0." return "ln" return * │
* *──────────────────────────────────────────────────────────────────────┘
* *── Add This Line to Have Dollar Signs ───────────────────────────────┐
* findreplace " 0." return "$0." return "ln" return * │
* *──────────────────────────────────────────────────────────────────────┘
END: unmarkblock begline restoresettings
*
* 142 bytes Mon 03-30-1992 17:54:35 (TH @3, Ver. 1, to GG #20/487)
* 151 bytes Tue 03-31-1992 11:21:58 (TH @3, for all wordwraps and #'s)
* 151 bytes Tue 03-31-1992 11:21:58 (TH @3, Ver. 2, to GG #20/491)
* 142 bytes Tue 03-31-1992 17:57:57 (TH @3, Ver. 3, shortened)
* 142 bytes Tue 03-31-1992 17:57:57 (TH @3, Ver. 3, to GG #20/492)
* 142 bytes Tue 03-31-1992 17:57:57 (TH @3, to All #3/827-828)
* 142 bytes Tue 03-31-1992 17:57:57 (TH @3, to All #3/829-830)
*
* --------------------------------------------------------------------
* @(4) Align Column Block By Decimal Point,
* Fill With Leading/Trailing Zeros, Ver. 2
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 123456789.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3.000│ │ 123456789.000│
* │ 1234.560│ │ 123456789.100│
* │ │ │ 123456789.120│
* │ 0.020│ │ 123456789.123│
* │ 213.679│ │ 123456789.000│
* │ 432.000│ │ 123456789.100│
* └──────────────┘ │ 123456789.120│
* │ 123456789.123│
* └─────────────────┘
@4 macrobegin
setscreenoff
savesettings setsoundoff setwordwrapmode togglewordwrap
editfile "nul" return quit gotoblockbeg jfalse END
editfile return copyblock markline
* *── Add This Line to Have Dollar Signs ───────────────────────────────┐
* findreplace "$" return " " return "gn" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* -------------------- Find Decimal Point Line 1 -------------------*
find "." return "L" return jtrue DOT1 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT1 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
DOT1: unmarkblock markcolumn endline storescrbuff "x" return cut
LINE: cursordown jfalse FIN
begline unmarkblock markline
* -------------------- Find Decimal Point Line 2+ ------------------*
find return "L" return jtrue DOT2 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT2 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
* ---------- Append Decimal Point + Fraction to Buffer "x" ---------*
DOT2: unmarkblock markcolumn endline appendscrbuff "x" return cut
jump LINE
* ------------ Make Numbers w/o Fractions a Column Block -----------*
FIN: begfile markcolumn
1A: endline 2A: cursorleft markcolumn cursordown jfalse 4A
3A: jump 1A 4A: gotoblockend cursorleft addline #173 cursorup
* *─- Add This Line to Comma Delineate Columns ─────────────────────────┐
* findreplace "," return delline return "gn" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* --------------- Right Justify Numbers w/o Fractions --------------*
LOOP: unmarkblock markcolumn endline
cut begline paste endline jtrue EMPTY gotoblockend
EMPTY: cursorleft cursorup jtrue LOOP
begfile cursorright unmarkblock markcolumn endfile cursorup
* *─- Add These Lines to Comma Delineate Columns ────────────────────────┐
* markcolumn cursorright * │
* COMMA_SPACE: * │
* cursorleft cursorleft cursorleft * │
* cursorleft jfalse ADD_COMMA * │
* isbegline jtrue ADD_COMMA * │
* gotoblockbeg markcolumn prevposition shiftleft * │
* jump COMMA_SPACE * │
* ADD_COMMA: * │
* endfile cursorup markcolumn begfile * │
* findreplace " " return "," return "n" return * │
* findreplace ",," return " " return "n" return * │
* findreplace " ," return " " return "n" return * │
* *-─────────────────────────────────────────────────────────────────────┘
* *── Add These 2 Lines to Have Dollar Signs ───────────────────────────┐
* setinsmode toggleinsert * │
* DOLLAR: firstnonwhite cursorleft "$" cursordown jtrue DOLLAR * │
* *-─────────────────────────────────────────────────────────────────────┘
* ------------- Paste Right Justified Whole Numbers Back -----------*
copy quit pasteover
* --------- Make Column Block of Decimal Points + Fractions --------*
gotoblockend markline gotoblockbeg
editfile return getscrbuff "x" return unmarkblock markcolumn
1B: endline 2B: cursorleft markcolumn cursordown jfalse 4B
3B: jump 1B 4B:
*── To Fill With Trailing Zeros, Uncomment These 2 Lines ─────────────┐
gotoblockbeg copy paste * │
findreplace " " return "0" return "ln" return * │
*-─────────────────────────────────────────────────────────────────────┘
copy quit pasteover * Paste decimal points + fractions back
*── To Add Leading Zero, Uncomment These 2 Lines ──────────────────────┐
cursorleft cursorleft markcolumn * │ *|
findreplace " ." return "0." return "ln" return * │
*──────────────────────────────────────────────────────────────────────┘
* *── Add This Line to Have Dollar Signs ───────────────────────────────┐
* findreplace " 0." return "$0." return "ln" return * │
* *──────────────────────────────────────────────────────────────────────┘
END: unmarkblock begline restoresettings
*
* 187 bytes Tue 03-31-1992 18:05:29 (TH @4, to GG #20/492)
* 187 bytes Tue 03-31-1992 18:05:29 (TH @4, to All #3/827-828)
* 188 bytes Wed 04-08-1992 11:24:48 (TH @4, Ver.2, added cursorleft *|)
* 188 bytes Wed 04-08-1992 11:24:48 (TH @4, to All #3/829-830)
*
* --------------------------------------------------------------------
* @(5) Comma Delineate and Align Column Block By Decimal Point,
* Fill With Leading/Trailing Zeros, Ver. 2
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 12345678o.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3.000│ │ 123,456,789.000│
* │ 1,234.560│ │ 123,456,789.100│
* │ │ │ 123,456,789.120│
* │ 0.020│ │ 123,456,789.123│
* │ 213.679│ │ 123,456,789.000│
* │ 432.000│ │ 123,456,789.100│
* └──────────────┘ │ 123,456,789.120│
* │ 123,456,789.123│
* └─────────────────┘
@5 macrobegin
setscreenoff
savesettings setsoundoff setwordwrapmode togglewordwrap
editfile "nul" return quit gotoblockbeg jfalse END
editfile return copyblock markline
* -------------------- Find Decimal Point Line 1 -------------------*
find "." return "L" return jtrue DOT1 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT1 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
DOT1: unmarkblock markcolumn endline storescrbuff "x" return cut
LINE: cursordown jfalse FIN
begline unmarkblock markline
* -------------------- Find Decimal Point Line 2+ ------------------*
find return "L" return jtrue DOT2 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT2 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
* ---------- Append Decimal Point + Fraction to Buffer "x" ---------*
DOT2: unmarkblock markcolumn endline appendscrbuff "x" return cut
jump LINE
* ------------ Make Numbers w/o Fractions a Column Block -----------*
FIN: begfile markcolumn
1A: endline 2A: cursorleft markcolumn cursordown jfalse 4A
3A: jump 1A 4A: gotoblockend cursorleft addline #173 cursorup
*─- Add This Line to Comma Delineate Columns ─────────────────────────┐
findreplace "," return delline return "gn" return * │
*-─────────────────────────────────────────────────────────────────────┘
* --------------- Right Justify Numbers w/o Fractions --------------*
LOOP: unmarkblock markcolumn endline
cut begline paste endline jtrue EMPTY gotoblockend
EMPTY: cursorleft cursorup jtrue LOOP
begfile cursorright unmarkblock markcolumn endfile cursorup
*─- Add These Lines to Comma Delineate Columns ────────────────────────┐
markcolumn cursorright * │
COMMA_SPACE: * │
cursorleft cursorleft cursorleft * │
cursorleft jfalse ADD_COMMA * │
isbegline jtrue ADD_COMMA * │
gotoblockbeg markcolumn prevposition shiftleft * │
jump COMMA_SPACE * │
ADD_COMMA: * │
endfile cursorup markcolumn gotoblockbeg * │
findreplace " " return "," return "ln" return * │
begfile * │
findreplace ",," return " " return "n" return * │
findreplace " ," return " " return "n" return * │
*-─────────────────────────────────────────────────────────────────────┘
* ------------- Paste Right Justified Whole Numbers Back -----------*
copy quit pasteover
* --------- Make Column Block of Decimal Points + Fractions --------*
gotoblockend markline gotoblockbeg
editfile return getscrbuff "x" return unmarkblock markcolumn
1B: endline 2B: cursorleft markcolumn cursordown jfalse 4B
3B: jump 1B 4B:
*── To Fill With Trailing Zeros, Uncomment These 2 Lines ─────────────┐
gotoblockbeg copy paste * │
findreplace " " return "0" return "ln" return * │
*-─────────────────────────────────────────────────────────────────────┘
copy quit pasteover * Paste decimal points + fractions back
*── To Add Leading Zero, Uncomment These 2 Lines ──────────────────────┐
cursorleft cursorleft markcolumn * │ *|
findreplace " ." return "0." return "ln" return * │
*──────────────────────────────────────────────────────────────────────┘
END: unmarkblock begline restoresettings
*
* 263 bytes Tue 04-07-1992 19:24:54 (TH @5)
* 263 bytes Tue 04-07-1992 19:24:54 (TH @5, to All #3/827-828)
* 264 bytes Wed 04-08-1992 11:31:13 (TH @5, Ver. 2, added cursorleft *|)
* 264 bytes Wed 04-08-1992 11:31:13 (TH @5, to All #3/829-830)
*
* --------------------------------------------------------------------
* @(6) Comma Delineate and Align Column Block By Decimal Point,
* Fill With Leading/Trailing Zeros, Add Dollar Signs, Ver. 2
* --------------------------------------------------------------------
* This This
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ 3 │ │123456789 │
* │1234.56 │ │ 123456789.1 │
* │ │ │123456789.12 │
* │ .02 │ │ 123456789.123│
* │ 213.679│ │123456789 │
* │ 432.0 │ │ 123456789.1 │
* └──────────────┘ │123456789.12 │
* │ 123456789.123│
* └─────────────────┘
* Becomes this Becomes this
* ┌── + ─── + ───┐ ┌─────────────────┐
* │ $3.000│ │ $123,456,789.000│
* │ $1,234.560│ │ $123,456,789.100│
* │ │ │ $123,456,789.120│
* │ $0.020│ │ $123,456,789.123│
* │ $213.679│ │ $123,456,789.000│
* │ $432.000│ │ $123,456,789.100│
* └──────────────┘ │ $123,456,789.120│
* │ $123,456,789.123│
* └─────────────────┘
@6 macrobegin
setscreenoff
savesettings setsoundoff setwordwrapmode togglewordwrap
editfile "nul" return quit gotoblockbeg jfalse END
editfile return copyblock markline
*── Add This Line to Have Dollar Signs ───────────────────────────────┐
findreplace "$" return " " return "gn" return * │
*-─────────────────────────────────────────────────────────────────────┘
* -------------------- Find Decimal Point Line 1 -------------------*
find "." return "L" return jtrue DOT1 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT1 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
DOT1: unmarkblock markcolumn endline storescrbuff "x" return cut
LINE: cursordown jfalse FIN
begline unmarkblock markline
* -------------------- Find Decimal Point Line 2+ ------------------*
find return "L" return jtrue DOT2 endline
*── To Fill With Zeros, Uncomment This Line ──────────────────────────┐
jfalse DOT2 "." cursorleft * │
*-─────────────────────────────────────────────────────────────────────┘
* ---------- Append Decimal Point + Fraction to Buffer "x" ---------*
DOT2: unmarkblock markcolumn endline appendscrbuff "x" return cut
jump LINE
* ------------ Make Numbers w/o Fractions a Column Block -----------*
FIN: begfile markcolumn
1A: endline 2A: cursorleft markcolumn cursordown jfalse 4A
3A: jump 1A 4A: gotoblockend cursorleft addline #173 cursorup
*─- Add This Line to Comma Delineate Columns ─────────────────────────┐
findreplace "," return delline return "gn" return * │
*-─────────────────────────────────────────────────────────────────────┘
* --------------- Right Justify Numbers w/o Fractions --------------*
LOOP: unmarkblock markcolumn endline
cut begline paste endline jtrue EMPTY gotoblockend
EMPTY: cursorleft cursorup jtrue LOOP
begfile cursorright unmarkblock markcolumn endfile cursorup
*─- Add These Lines to Comma Delineate Columns ────────────────────────┐
markcolumn cursorright * │
COMMA_SPACE: * │
cursorleft cursorleft cursorleft * │
cursorleft jfalse ADD_COMMA * │
isbegline jtrue ADD_COMMA * │
gotoblockbeg markcolumn prevposition shiftleft * │
jump COMMA_SPACE * │
ADD_COMMA: * │
endfile cursorup markcolumn begfile * │
findreplace " " return "," return "n" return * │
findreplace ",," return " " return "n" return * │
findreplace " ," return " " return "n" return * │
*-─────────────────────────────────────────────────────────────────────┘
*── Add These 2 Lines to Have Dollar Signs ───────────────────────────┐
setinsmode toggleinsert * │
DOLLAR: firstnonwhite cursorleft "$" cursordown jtrue DOLLAR * │
*-─────────────────────────────────────────────────────────────────────┘
* ------------- Paste Right Justified Whole Numbers Back -----------*
copy quit pasteover
* --------- Make Column Block of Decimal Points + Fractions --------*
gotoblockend markline gotoblockbeg
editfile return getscrbuff "x" return unmarkblock markcolumn
1B: endline 2B: cursorleft markcolumn cursordown jfalse 4B
3B: jump 1B 4B:
*── To Fill With Trailing Zeros, Uncomment These 2 Lines ─────────────┐
gotoblockbeg copy paste * │
findreplace " " return "0" return "ln" return * │
*-─────────────────────────────────────────────────────────────────────┘
copy quit pasteover * Paste decimal points + fractions back
*── To Add Leading Zero, Uncomment These 2 Lines ──────────────────────┐
cursorleft cursorleft markcolumn * │
findreplace " ." return "0." return "ln" return * │
*──────────────────────────────────────────────────────────────────────┘
*── Add This Line to Have Dollar Signs ───────────────────────────────┐
findreplace " 0." return "$0." return "ln" return * │
*──────────────────────────────────────────────────────────────────────┘
END: unmarkblock begline restoresettings
*
* 306 bytes Tue 04-07-1992 22:45:28 (TH @6)
* 306 bytes Tue 04-07-1992 22:45:28 (TH @6, to All #3/827-828)
* 303 bytes Wed 04-08-1992 09:21:16 (TH @6, Ver. 2, shortened)
* 303 bytes Wed 04-08-1992 09:21:16 (TH @6, to All #3/829-830)
*
* ----------------------------------------------------------------------
* @(9) Right Justify Paragraph, QEdit v2.15 Only
* ----------------------------------------------------------------------
* This macro will right justify any column that is a paragraph, i.e.
* delineated by blank lines on top and bottom. If the paragraph is at
* the eof and does not have a blank line at the end, the macro inserts
* a blank line.
* This:
19
24
1
385
173
* Becomes this:
19
24
1
385
173
@9 macrobegin
setscreenoff
* ------------- Make column block of longest number -------------*
cursordown prevpara
begline *|
unmarkblock markcolumn endline
1: cursorleft markcolumn cursordown
jtrue 2 addline 2: *|
begline endline jtrue 1
* ---------------- Insert right position markers ----------------*
gotoblockend markline gotoblockbeg markcolumn
prevposition fillblock #173 return prevposition
* ------------------------ Right justify ------------------------*
5: delch unmarkblock markcolumn endline markcolumn
begline moveblock endline cursordown cursorleft
isemptyline jfalse 5
* -------------------------- Reposition --------------------------*
markline prevpara markline shiftleft unmarkblock
*
* 48 bytes Sun 12-08-1991 11:16:30 (TH @F9, to EW #20/24)
* 47 bytes Mon 01-13-1992 09:49:22 (TH @9, removed onewindow)
* 47 bytes Mon 03-30-1992 14:44:08 (TH @9, corrected Label 5)
* 52 bytes Sat 06-13-1992 11:21:22 (TH to LS #21/_____ 6/13)
* 52 bytes Sat 06-13-1992 11:21:22 (TH @9 modified for para at eof *|)
*
* ----------------------------------------------------------------------
* @(0) Left Justify Text in Line or Block to Designated Column
* ----------------------------------------------------------------------
* This macro will left justify the current line or each line of text in
* a line block to a user selected designated column. Only lines
* containing text from column 1 to the user selected column will be
* left justified.
* A line block may be marked before invoking, either open or closed,
* and operation will proceed pausing only to select column to left
* justify to. This macro will not justify the last line in a file.
* QEdit v2.15 is required.
* For example, marking the first four lines without the box and
* asterisks and positioned in column 1, selecting 3 at the gotocolumn
* prompt:
* ┌────+────┐
* │12345 │
* │ 45678 │
* │ 56789│
* │ 23456 │
* │ 34567 │
* │ 45678 │
* │ 56789│
* └─────────┘
* We get...
* ┌────+────┐
* │ 12345 │
* │ 45678 │
* │ 56789│
* │ 23456 │
* │ 34567 │
* │ 45678 │
* │ 56789│
* └─────────┘
* Note, line 3 is not left justified because it has no text in col's
* 1-3
@0 macrobegin
setinsmode
* ---------------- Mark/Close Block if Not Marked ----------------*
gotoblockbeg jtrue ok markline
gotoblockbeg jtrue ok
pause
markline
gotoblockbeg
ok:
* ---------------- Select Column to Left Justify ----------------*
begline gotoblockend
markcolumn * Mark 1st char of last line
prevposition * Return to block begin
gotocolumn
pause
return
setscreenoff
markcolumn * Close column block
* ------------------------- Left Justify -------------------------*
PUSH:
firstnonwhite
L5:
iscursorinblock
jfalse NEXT_LINE
" " * Push text right 'til none in block
jump L5
NEXT_LINE:
cursordown begline
iscursorinblock
jtrue PUSH * Are we past block?
unmarkblock
*
* 43 bytes Wed 06-10-1992 09:07:14 (TH @0)
*
* ----------------------------------------------------------------------
* @(f1) Right Justify Block Using RJ.COM
* ----------------------------------------------------------------------
* This macro right justifies a marked block or a user selected block
* using RJ.COM. If a block is marked before invoking this macro,
* either open or closed, it will be processed without pause. If no
* block is marked, the macro pauses for the user to select the block
* end by cursoring to end of desired block and pressing <enter>.
* This paragraph marked as a block was right justified using @f1.
* Requires QEdit v2.15.
@f1 Macrobegin onewindow
* --------------------------- Select Block ---------------------------*
gotoblockend jtrue A markline gotoblockend jtrue OK pause jump B
A: gotoblockbeg unmarkblock markline prevposition
B: markline
OK: setscreenoff
* ----------------------- Right Justify Block -----------------------*
gotoblockbeg
endline cursorright
writeblock "c:!" return
return "o" backspace * Overwrite block to temp file c:!
editfile
endline ".rj" return
return quit * Quit c:!.rj if loaded
gotoblockbeg
cut * Remove unjustified block
DOS
"RJ c:!>c:!.rj"
return return * Right justify block to c:!.rj
readblock return * Read right justified block c:!.rj
editfile return killfile quit * Kill/quit c:!.rj
gotoblockbeg * Return to block begin
* unmarkblock
*
* 83 bytes Mon 02-25-1991 06:51:47
* 86 bytes Wed 05-13-1992 12:36:37 (TH @F6, modified for all Qconfig's)
* 89 bytes Mon 05-18-1992 12:01:16 (TH @f1, select or process marked block)
* 88 bytes Tue 05-19-1992 11:38:20 (TH @f1, w/o unmarkblock)
* (Documentation) for RJ.COM
* ------------------------------
* USAGE: RJ <INFILE> { PRINT_MARGIN F S }
*
* WHERE: 0=< PRINT_MARGIN =<40 Default = 0 enter like: 8
* F FILTERS control chars Default = OFF enter like: F
* S SUPPRESS Line Feeds after CR Default = OFF enter
* PURPOSE: RJ Right Justifies your printer output, making it look
* professional. RJ right justifies text files by imbedding
* blanks between words. It is compatible with VDE or any other
* ASCII text editor. Public domain.
* METHOD: RJ imbeds spaces between words. It calculates the longest
* line in the file (40 to 255 char), then justifies shorter lines
* (up to 15% shorter ). Non-printable control characters are not
* counted for formatting purposes, so leave them in if you wish.
* Carriage Returns, Line Feeds, Form Feeds, and Tabs are always
* processed normally and printed. Indenting at the beginning of
* the line is disregarded, but any line with 3+ IMBEDDED spaces,
* or any line with Tabs is not justified. This leaves tables,
* charts, etc. intact.
* HINTS: All parameters except INFILE are optional and they may be
* entered in any order; the defaults are above. Note that the
* input file is left unaltered; output defaults to the screen.
* This allows you to preview your printer output. To print or
* copy your right justified file, use the DOS redirection
* operator: RJ REPORT.TXT F 6 > PRN. Save your normal parameters
* in a batch file.
*
* ----------------------------------------------------------------------
* @(f2) Removes Right Justification From Block
* ----------------------------------------------------------------------
* This macro removes right justification added with @f1 using RJ.COM
* from a marked block or a user selected block. If a block is marked
* before invoking this macro, either open or closed, it will be
* processed without pause. If no block is marked, the macro pauses for
* the user to select the block end by cursoring to end of desired block
* and pressing <enter>. Requires QEdit v2.15.
* The macro removes removes right justification from the above as
* follows:
* This macro removes right justification added with @f1 using RJ.COM
* from a marked block or a user selected block. If a block is marked
* before invoking this macro, either open or closed, it will be
* processed without pause. If no block is marked, the macro pauses for
* the user to select the block end by cursoring to end of desired block
* and pressing <enter>. Requires QEdit v2.15.
@f2 macrobegin onewindow
* --------------------------- Select Block ---------------------------*
gotoblockend jtrue A markline gotoblockend jtrue OK pause jump B
A: gotoblockbeg unmarkblock markline prevposition
B: markline
OK: setscreenoff
* ------ Make Line Block a Column Block, Exclude Leading Spaces ------*
1: begline addline "*" #173 gotoblockbeg
2: isemptyline jfalse 3 cursordown jump 2
3: firstnonwhite markcolumn endline cursorleft
4: cursordown isemptyline jtrue 4 isendline jtrue 5 endline cursorleft
5: markcolumn Find "*" #173 return delline return jfalse 6
prevposition firstnonwhite iscursorinblock jtrue 4 markcolumn jump 4
6: delline
* ---------------------- Copy block to Nul file ----------------------*
editfile "Nul" return quit
gotoblockbeg cut
editfile return
paste
* --------------------- Remove All Extra Spaces ---------------------*
unmarkblock endline markcolumn
REMOVE:
firstnonwhite markcolumn
findreplace " " return " " return "ln" return
findreplace " " return return "ln" return
findreplace " " return return "ln" return
endline iscursorinblock jtrue EOL_OK markcolumn
EOL_OK:
cursordown jtrue REMOVE
* ---------- Replace 'Period Space' With 'Period Two Spaces ----------*
begfile
findreplace "." " " return "." " " return "n" return
* ------------- Paste Block Back Where It Was, Quit Nul -------------*
copy quit pasteover
* unmarkblock
*
* 81 bytes Wed 02-20-1991 12:48:50
* 171 bytes Tue 05-19-1992 09:22:38 (TH @f2, select or process marked block)
* 170 bytes Tue 05-19-1992 11:38:57 (TH @f2, w/o unmarkblock)
*
* ----------------------------------------------------------------------
* @(f3) Right Justify File With Same Prefix and ".rj" Extension
* Using RJ.COM
* ----------------------------------------------------------------------
* This macro uses the right justification program RJ.COM, which is
* included and must be located in current directory or path, to right
* justify the current file. The right justified file with extension
* '.rj' is loaded for editing. Requires QEdit v2.15.
* A file may also be right justified using @f1 by marking the file as
* as block and invoking @f1. @f3 differs from @f1 in that a separate
* rightjustified file with name.rj is loaded for editing. @f1 replaces
* the marked block with a right justified block and is faster than @f3
* if c:\ is a ram drive. Files with extension '.rj' cannot be right
* justified.
@f3 macrobegin
unmarkblock begfile insertline * Insert temp line with
dropanchor currentfilename * CurrentFileName marked
find "." return "b" return * Find dot backwards
jfalse NO_EXT *|
deltoeol *|
NO_EXT: *|
".rj" * Add ".rj" after dot
setscreenoff *|
cut * Cut name.rj to scrap
savefile * Save file
DOS
"RJ " currentfilename * Right justify file
">" paste return return * To name.rj
editfile paste return quit * Quit justified file if loaded
editfile return * Reload justified file
* ----- Remove Right Justification From Last Line in Paragraphs -----*
REMOVE:
endpara markcolumn firstnonwhite *|
findreplace " " return " " return "ln" return
findreplace " " return return "ln" return
findreplace " " return return "ln" return
unmarkblock cursordown *|
jtrue REMOVE
begfile
*
* 106 bytes Wed 02-20-1991 16:28:30
* 101 bytes Tue 05-19-1992 09:02:47 (TH @f3)
*
* ----------------------------------------------------------------------
* @(f4) Removes Right Justification From File
* ----------------------------------------------------------------------
* This macro removes right justification from a file added with @f3
* using RJ.COM from a marked block or a user selected block. If a block
* is marked before invoking this macro, either open or closed, it will
* be processed without pause. If no block is marked, the macro pauses
* for the user to select the block end by cursoring to end of desired
* block and pressing <enter>. Requires QEdit v2.15.
@f4 macrobegin
begfile
setscreenoff
* --------------------- Remove All Extra Spaces ---------------------*
unmarkblock endline markcolumn
REMOVE:
firstnonwhite markcolumn
findreplace " " return " " return "ln" return
findreplace " " return return "ln" return
findreplace " " return return "ln" return
endline iscursorinblock jtrue EOL_OK markcolumn
EOL_OK:
cursordown jtrue REMOVE
* ---------- Replace 'Period Space' With 'Period Two Spaces ----------*
begfile unmarkblock
findreplace "." " " return "." " " return "n" return
*
* 80 bytes Wed 02-20-1991 12:46:32 (TH @f5)
* 83 bytes Tue 05-19-1992 09:45:17 (TH @f4, shortened)
*
* ----------------------------------------------------------------------
* @(f5) Right Justify File, Screen Preview
* ----------------------------------------------------------------------
* This macro uses the right justification program RJ.COM, which is
* included and must be located in current directory or path, to right
* justify the current file for screen preview. No right jusitified
* file is loaded for editing.
@f5 Macrobegin Savefile DOS "RJ " Currentfilename Return
*
* 14 bytes Sun 12-02-1990 01:02:50 (TH, @f5)
*
* ----------------------------------------------------------------------
* @(f7) Left Justify Lines Containing Any Type Block
* ----------------------------------------------------------------------
* This macro will left justify lines containing any type open or closed
* block.
@f7 macrobegin gotoblockend jtrue NEXT markline gotoblockend jfalse END
NEXT: begline gotoblockbeg prevposition begline
unmarkblock markcolumn prevposition cursorright centerline begline
END: unmarkblock
*
* 24 bytes Sun 01-12-1992 19:35:58 (TH @f7)
*
* ----------------------------------------------------------------------
* @(f8) Left Justify File
* ----------------------------------------------------------------------
@f8 macrobegin unmarkblock begfile endfile begline
markcolumn begfile cursorright centerline unmarkblock
*
* 13 bytes Sun 01-12-1992 19:48:18 (TH @f8)